package com.shudes.container;

import com.shudes.pt.container.*;

public class ContainerFilter<P,C> {
	protected Filter<C> filter;
	
	public ContainerFilter(Filter<C> filter) { 
		this.filter=filter; 
	}
		
	public Container<P,C> filter(Container<P,C> container) {
		Container<P,C> n;

		n = container.newContainer();
		for(C child : container) {
			if(filter.include(child))
				n.addChild(child);
		}
		
		return n; 
	}	

}
